<%@ page contentType="text/html;charset=UTF-8"
	import="petertel.pbx.conf.*"%>
<%@ include file="common/common.jsp"%>
<c:set var="currentDevice" value="${sipConf.currentDevice}" />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>拨号计划</title>
<link href="${contextPath}/style/common.css" rel="stylesheet"
	type="text/css" />
<script src="${contextPath}/jscript/jquery-1.7.2.js"></script>
<script type="text/javascript">

	function addContext() {
		var name = prompt("请输入上下文的名字：");
		if (!name) {
			return;
		}
		location.href="${contextPath}/extensionsConf/addContext.fb?contextName="+name;
	}

	function removeContext() {
		var name = "${extensionsConf.currentContextName}";
		var ok = confirm("确实要删除上下文"+name+"吗？");
		if (!ok) {
			return;
		}
		location.href="${contextPath}/extensionsConf/removeContext.fb?contextName="+name;
	}
	
	function insertStatement(index) {
		alert(index);
	}
	
</script>
</head>
<body>
	<div id="tools" class="listbar">
		<div style="float: left; margin-left: 5px;">
			<input type="submit" value="重置" class="button-blue"
				onclick="reset();">
			<input type="submit" id="applyButton" value="应用"
				class="${extensionsConf.dirty?'button-red':'button-blue'} " onclick="apply();">
			<input
				type="submit" id="addButton" value="添加" class="button-blue"
				onclick="addContext();">
			<input type="submit"
				id="deleteButton" value="删除" class="button-blue"
				onclick="removeContext();">
		</div>
	</div>
	<div style="margin-left: 10px;">
		<c:forEach items="${extensionsConf.contexts}" var="contextName">
			<a href="${contextPath}/extensionsConf/show.fb?contextName=${contextName}"
				class="${contextName==extensionsConf.currentContextName?'blue':''}"
				style="margin: 3px;">${contextName}</a>
		</c:forEach>
	</div>
	<div>
			<table class="table-gray">
				<tr class="thead-gray">
					<td style="height: 28px; width: 15%;">名称</td>
					<td style="width: 10%;">标签</td>
					<td style="width: 5%;">优先级</td>
					<td style="width: 40%;">应用</td>
					<td style="width: 20%;">操作</td>
				</tr>
				<c:forEach items="${extensionsConf.statements}" var="statement" varStatus="vs">
					<tr class="${statement.toggle?'tr-white':'tr-gray'}">
						<td style="${statement.displayName?'font-weight: bold':''}">
							${statement.displayName?statement.nameEditor:''}
						</td>
						<td>
							<input value='${statement.label}' style="width: 100%"/>
						</td>
						<td>
							<input value='${statement.priority}' style="width: 100%"/>
						</td>
						<td>
							<input value='${statement.application}' style="width: 100%"/>
						</td>
						<td>
							<input type="button" value="插入" onclick="insertStatement(${vs.count})"/>
							<input type="button" value="删除" />
						</td>
					</tr>
				</c:forEach>
				<tr class="">
						<td style="${statement.displayName?'font-weight: bold':''}"></td>
						<td></td>
						<td></td>
						<td></td>
						<td>
							<input type="button" value="插入" onclick="insertStatement(0)"/>
						</td>
					</tr>
			</table>
	</div>
</body>
</html>
<!-- 

 -->